package com.zp.reflection;

import java.lang.reflect.Method;

public class ReflectTest5 {
	public static void main(String[] args) throws Exception {
		Private p = new Private();
		Class<?> classType = p.getClass();
		Object instance = classType.newInstance();
		Method method = classType.getDeclaredMethod("sayHello",new Class[]{String.class});
		
		//访问私有方法使用：压制java的访问控制检查；
		method.setAccessible(true);
		
		Object value = method.invoke(instance,"zhangpeng");
		System.out.println(value);
	}
}
